package com.example.day04;

import java.net.SocketTimeoutException;
import java.sql.SQLOutput;

public class StringTest {
    public static void main(String[] args) {
        String s1 = "hello"; // 直接量
        String s2 = new String();
        String s3 = new String("hi");
        System.out.println(s1 + s2 + s3);

        char[] chars = {'h','e','l','l','o'};
        String s4 = new String(chars);
        System.out.println(s4);

        System.out.println(s4.charAt(4));

        System.out.println(s4.contains("he"));
        System.out.println(s4.replace('h', 'a'));
        System.out.println(s4);

        String s5 = "hello,my,morning";
        String[] strings = s5.split(",");
        for (String string : strings) {
            System.out.println(string);
        }

        System.out.println(s5.substring(9));
        System.out.println(s5.substring(6,8));

        System.out.println(String.valueOf(true) + String.valueOf(false));

    }
}
